﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data;

public partial class Report : System.Web.UI.Page
{
    Xqsys.MODEL.Report report = new Xqsys.MODEL.Report();
    protected void Page_Load(object sender, EventArgs e)
    {
        CKEditorControl1.config.toolbar = new object[]
        {
            //配置文档编辑器
 			new object[] { "Save", "NewPage", "Preview", "-", "Templates" },
			new object[] { "Cut", "Copy", "Paste", "PasteText", "PasteFromWord", "-", "Print",},
			new object[] { "Undo", "Redo", "-", "Find", "Replace", "-", "SelectAll", "RemoveFormat" },
            new object[] { "Image", "Flash", "HorizontalRule", "Smiley", "SpecialChar", "PageBreak"},
            new object[] { "Link", "Unlink", "Anchor" },
            new object[] { "Maximize", "ShowBlocks", "-"},                         
			"/",
            new object[] { "Bold", "Italic","Underline", "Strike","-","TextColor", "BGColor"},				
			new object[] { "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock" },			
			new object[] { "NumberedList", "BulletedList", "-","Outdent", "Indent"},
            new object[] { "Styles", "Format", "Font", "FontSize" }			             
        };
        if (Session["se1"] == null)
        {
            lit.Text = "<script>alert('请登录');</script>";
        }
        else
        {
            loginname.Text = Session["se1"].ToString();
            if (Session["se1"] == null)
            {
                lit.Text = "<script>alert('请登录');</script>";
                Response.Redirect("~/index.aspx");
            }
            else
            {
                loginname.Text = Session["se1"].ToString();
                if (Session["Role"].ToString() == "2")
                {
                    Panel1.Visible = true;
                    Panel2.Visible = true;
                    Panel3.Visible = true;
                }
                else
                {
                    Panel1.Visible = false;
                    Panel2.Visible = false;
                    Panel3.Visible = false;
                }
            }
        }
    }
    protected void zhuxiao_Click(object sender, EventArgs e)
    {
        Session.Clear();
        Response.Redirect("~/index.aspx");
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        DateTime newtime = DateTime.Now;     
        if (DropDownList1.SelectedItem.Text == "周报")
        {
            report.Type = "周报";
        }
        if (DropDownList1.SelectedItem.Text == "月报")
        {
            report.Type = "月报";
        }
        report.Intime = newtime;
        report.Week = TextBox1.Text;
        report.Text = CKEditorControl1.Text;
        report.UsersID = Convert.ToInt32(Session["userID"]);
        report.IsCommit = 1 ;
        if (new Xqsys.BLL.Report().AddReport(report))
        {
            lit.Text = "<script>alert('提交成功！');</script>";
        }
        else
        {
            lit.Text = "<script>alert('提交失败！');</script>";
        }
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("");
    }
    protected void Button3_Click(object sender, EventArgs e)
    {

    }
}